const utils = {
  state: {
    screenWidth: 200,
    menuImgCur: true,
    sameComponentsName: [// 处理页面名和组件名不一致的情况
      { fileName: 'OnlCgformAutoListYS', componentName: 'OnlCgformAutoListYS' },
      { fileName: 'OnlCgformTreeListYS', componentName: 'OnlCgformTreeList' }
    ], // 框架动态组件name
    keepAliveList: [],
    routerKey: ''
  },
  mutations: {
    SET_SCREENWIDTH: (state, fixed) => {
      state.screenWidth = fixed
    },
    SET_REDACTMENUIMGCUR: (state, fixed) => {
      state.menuImgCur = fixed
    },
    // 路由信息List方法
    SETPUSH_CHANGEKEEPALIVELIST: (state, fixed) => {
      state.keepAliveList.indexOf(fixed) < 0 && state.keepAliveList.push(fixed)
    },
    SET_CHANGEKEEPALIVELIST: (state, fixed) => {
      state.keepAliveList = [...new Set(fixed)] // 组件地址更换
    },
    SET_ROUTERKEY: (state, fixed) => {
      state.routerKey = fixed
    }
  },
  actions: {
    // 宽度
    TOSET_SCREENWIDTH({ commit }, value) {
      commit('SET_SCREENWIDTH', value)
    },
    // menu 的菜单模式
    TOSET_REDACTMENUIMGCUR({ commit }, value) {
      commit('SET_REDACTMENUIMGCUR', value)
    },
    // 路由信息List方法
    TOSETPUSH_CHANGEKEEPALIVELIST({ commit }, value) {
      commit('SETPUSH_CHANGEKEEPALIVELIST', value)
    },
    TOSET_CHANGEKEEPALIVELIST({ commit }, value) {
      commit('SET_CHANGEKEEPALIVELIST', value)
    },
    TOSET_ROUTERKEY({ commit }, value) {
      commit('SET_ROUTERKEY', value)
    }
  }
}
export default utils
